
function check_user_name(user_name,fromid,hint){
	var checktext = /^\s*$/;
	var user_name_value=user_name.value;
	$("#"+hint).removeClass("txt_okay");
	$("#"+hint).addClass("txt_tx");
	if(user_name_value==""||checktext.test(user_name_value)==true){
		$("#"+hint)[0].innerHTML="\u8bf7\u8f93\u5165\u7528\u6237\u540d";
		return(false);
	}else{
		$.ajax({
			url:'./ajax/checkIndex.php?t='+(new Date().getTime()),
			type:'post',
			data:{act:"check_user",user_name:user_name_value,fromid:fromid},
			timeout: 3000,
			success:function(data){
			data=data.replace(/(^\s+)|(\s+$)/g,"");
           if(data){//true
        	   var dataObj=eval("("+data+")");
               	if(dataObj.root[0].status == "true"){
               		$("#"+hint).addClass("txt_okay");
               		$("#"+hint)[0].innerHTML=dataObj.root[0].Description;
				   }else{
					   $("#"+hint)[0].innerHTML=dataObj.root[0].Description;
				   }
				}else{//false
					$("#"+hint)[0].innerHTML="\u65e0\u6cd5\u9a8c\u8bc1\x2c\u8bf7\u91cd\u65b0\u5c1d\u8bd5";
					setTimeout(function(){$("#"+hint)[0].innerHTML="";},2000);
				}
			},
			error:function(erg){
				$("#"+hint)[0].innerHTML="\u65e0\u6cd5\u9a8c\u8bc1\x2c\u8bf7\u91cd\u65b0\u5c1d\u8bd5";
				setTimeout(function(){$("#"+hint)[0].innerHTML="";},2000);
			}
		});
	}
}
function check_password(password,hint){
	var checktext = /^\s*$/;
	var user_name_value=$("#user_name")[0].value;
	var password_value=password.value;
	$("#"+hint).removeClass("txt_okay");
	$("#"+hint).addClass("txt_tx");
	if(password_value==""||checktext.test(password_value)==true){
		$("#"+hint)[0].innerHTML="\u8bf7\u8f93\u5165\u5bc6\u7801";
		return(false);
	}else{
		$.ajax({
			url:'./ajax/checkIndex.php?t='+(new Date().getTime()),
			type:'post',
			data:{act:"check_password",user_name:user_name_value,password:password_value},
			timeout: 3000,
			success:function(data){
			data=data.replace(/(^\s+)|(\s+$)/g,"");
           if(data){//true
        	   var dataObj=eval("("+data+")");
               	if(dataObj.root[0].status == "true"){
               		$("#"+hint).addClass("txt_okay"); 
               		$("#"+hint)[0].innerHTML=dataObj.root[0].Description;   
				   }else{
					   $("#"+hint)[0].innerHTML=dataObj.root[0].Description;
				   }
				}else{//false
					$("#"+hint)[0].innerHTML="\u65e0\u6cd5\u9a8c\u8bc1\x2c\u8bf7\u91cd\u65b0\u5c1d\u8bd5";
					setTimeout(function(){$("#"+hint)[0].innerHTML="";},2000);
				}
			},
			error:function(erg){
				$("#show_msg")[0].innerHTML="\u65e0\u6cd5\u9a8c\u8bc1\x2c\u8bf7\u91cd\u65b0\u5c1d\u8bd5";
				setTimeout(function(){$("#"+hint)[0].innerHTML="";},2000);
			}
		});
	}
}
function check_captcha(captcha,showid){
	var checktext = /^\s*$/;
	$("#"+showid).removeClass("txt_okay");
	$("#"+showid).addClass("txt_tx");
	if(captcha.value==""||checktext.test(captcha.value)==true){
		$("#"+showid)[0].innerHTML="\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801";
		return(false);
	}else{
		$.ajax({
			url:'./ajax/checkIndex.php?t='+(new Date().getTime()),
			type:'post',
			data:{act:"captcha",captcha:captcha.value},
			timeout: 3000,
			success:function(data){
			data=data.replace(/(^\s+)|(\s+$)/g,"");
           if(data){//true
        	   var dataObj=eval("("+data+")");
               	if(dataObj.root[0].status == "true"){
               		$("#"+showid).addClass("txt_okay");
               		$("#"+showid)[0].innerHTML=dataObj.root[0].Description;
               		setTimeout(function(){$("#"+showid)[0].innerHTML="";},2000);
				   }else{
					$("#"+showid)[0].innerHTML=dataObj.root[0].Description;
				   }
				}else{//false
					$("#"+showid)[0].innerHTML="\u9a8c\u8bc1\u7801\u9519\u8bef";
				}

			},
			error:function(erg){
				$("#"+showid)[0].innerHTML="\u9a8c\u8bc1\u7801\u9519\u8bef";
			}
		});
	}
}

function check_email(email,fromid,hint){
	var checktext = /^\s*$/;
	var emailreg =/^([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,4}$/;
	var email_value=email.value;
	$("#"+hint).removeClass("txt_okay");
	$("#"+hint).addClass("txt_tx");
	if(email_value==""||checktext.test(email_value)==true){
		$("#"+hint)[0].innerHTML="请输入邮箱";
		return(false);
	}else if(email_value.length>60){
		$("#"+hint)[0].innerHTML="您输入的邮箱过长";
		return(false);
	}else if(!emailreg.test(email_value)){
		$("#"+hint)[0].innerHTML="请输入有效的邮箱";
		return(false);
	}
	else{
		$.ajax({
			url:'./ajax/checkIndex.php?t='+(new Date().getTime()),
			type:'post',
			data:{act:"check_email",email:email_value,fromid:fromid},
			timeout: 3000,
			success:function(data){
			data=data.replace(/(^\s+)|(\s+$)/g,"");
           if(data){//true
        	   var dataObj=eval("("+data+")");
               	if(dataObj.root[0].status == "true"){
               		$("#"+hint).addClass("txt_okay");
               		$("#"+hint)[0].innerHTML=dataObj.root[0].Description;
				   }else{
					   $("#"+hint)[0].innerHTML=dataObj.root[0].Description;
				   }
				}else{//false
					$("#"+hint)[0].innerHTML="\u65e0\u6cd5\u9a8c\u8bc1\x2c\u8bf7\u91cd\u65b0\u5c1d\u8bd5";
					setTimeout(function(){$("#"+hint)[0].innerHTML="";},2000);
				}
			},
			error:function(erg){
				$("#"+hint)[0].innerHTML="\u65e0\u6cd5\u9a8c\u8bc1\x2c\u8bf7\u91cd\u65b0\u5c1d\u8bd5";
				setTimeout(function(){$("#"+hint)[0].innerHTML="";},2000);
			}
		});
	}
}

function send_mail(){
	var emailreg =/^([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.|-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,4}$/;
	var checktext = /^\s*$/;
	var email_value=$("#email")[0].value;
	var captcha_value=$("#captcha")[0].value;
	$("#show_msg").removeClass("txt_okay");
	$("#show_msg").addClass("txt_tx");
	if(email_value==""||checktext.test(email_value)==true){
		$("#email_hint")[0].innerHTML="请输入您的邮箱";
		return(false);
	}
	else if(email_value.length>60){
		$("#email_hint")[0].innerHTML="您输入的邮箱过长";
		return(false);
	}
	else if(!emailreg.test(email_value)){
		$("#email_hint")[0].innerHTML="请输入有效的邮箱";
		return(false);
	}
	else if(captcha_value==""||checktext.test(captcha_value)==true){
		$("#captcha_hint")[0].innerHTML="请输入验证码";
		return(false);
	 }
	else{
		$("#show_msg")[0].innerHTML="<img src='./images/hint/IconRun.gif' />正在提交找回...";
		$.ajax({
			url:'./ajax/checkIndex.php?t='+(new Date().getTime()),
			type:'post',
			data:{act:"send_mail",email:email_value,captcha:captcha_value},
			timeout: 3000,
			success:function(data){
			data=data.replace(/(^\s+)|(\s+$)/g,"");
           if(data){//true
        	   var dataObj=eval("("+data+")");
               	if(dataObj.root[0].status == "true"){
               		$("#psmail").show();$("#getpsd").hide();
               		$("#you_email")[0].innerHTML=email_value;
				   }else{ 
					   $("#show_msg")[0].innerHTML=dataObj.root[0].Description;
					   setTimeout(function(){$("#show_msg")[0].innerHTML="";},3000);
				   }
				}else{//false
					$("#show_msg")[0].innerHTML="无法提交找回,请重新尝试";
					setTimeout(function(){$("#show_msg")[0].innerHTML="";},2000);
				}

			},
			error:function(erg){
				$("#show_msg")[0].innerHTML="无法提交找回,请重新尝试";
				setTimeout(function(){$("#show_msg")[0].innerHTML="";},2000);
			}
		});
		return(true);
	}
}

